package com.crm.service.impl.sys;

import com.crm.common.util.CommonUtils;
import com.crm.dao.mapper.sys.SalesmanSupportLogMapper;
import com.crm.model.dto.MainSalesmanDto;
import com.crm.model.entity.sys.SalesmanSupportLog;
import com.crm.service.sys.MainSalesmanDbService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * @description 首页销售明星榜 服务接口实现类
 * @author yun_cheng
 * @date 2021年12月23日 上午 09:05:40
 */
@Service
public class MainSalesmanDbServiceImpl implements MainSalesmanDbService {

    @Autowired
    SalesmanSupportLogMapper salesmanSupportLogMapper;

    @Override
    public Boolean insertSupportLog(SalesmanSupportLog salesmanSupportLog) {
        int count = salesmanSupportLogMapper.insertSelective(salesmanSupportLog);
        if (count > 0) {
            return true;
        }
        return false;
    }

    @Override
    public List<Map<String, String>> isSupported(String supportAccountId, List<MainSalesmanDto> salesMainList, String supportDate) {
        return this.salesmanSupportLogMapper.isSupported(supportAccountId, salesMainList, supportDate);
    }

    @Override
    public List<Map<String, Object>> salesmanGiftStat(List<MainSalesmanDto> salesMainList, String supportDate) {
        return this.salesmanSupportLogMapper.salesmanGiftStat(salesMainList, supportDate);
    }

    @Override
    public boolean isOptionByType(String accountId, String supportedAccountId, Integer type, String supportDate) {
        String id = this.salesmanSupportLogMapper.isOptionByType(accountId, supportedAccountId, type, supportDate);
        if (StringUtils.isNotBlank(id)) {
            return true;
        }
        return false;
    }

    @Override
    public List<Map<String, String>> getAccessUrlByAccountId(List<MainSalesmanDto> salesmanList) {
        return this.salesmanSupportLogMapper.getAccessUrlByAccountId(salesmanList);
    }

    @Override
    public List<Map<String, Object>> getTopSalesmanMessage() {
        return this.salesmanSupportLogMapper.getTopSalesmanMessage();
    }
}
